import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const ConstantRouterMap = [{
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  {
    path: '/pageFork',
    name: 'pageFork',
    component: () => import('@/views/page-fork'),
  },
  {
    path: '/forgotPassword',
    name: 'forgotPassword',
    component: () => import('@/views/forgot-password'),
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error-page/404')
  },
]

export const StudentAsyncRoutesMap = [{
    path: '/',
    name: 'student',
    component: () => import('@/layout/student'),
    meta: {
      role: "ROLE_student"
    },
    children: [{
        path: '',
        name: 'main',
        component: () => import('@/layout/student/container/main')
      },
      {
        path: 'classCenter',
        name: 'classCenter',
        component: () => import('@/layout/student/container/classCenter')
      },
      {
        path: 'courseCenter',
        name: 'courseCenter',
        component: () => import('@/layout/student/container/courseCenter')
      },
      {
        path: 'lessonDetail',
        name: 'lessonDetail',
        component: () => import('@/components/LessonDetail')
      },
      {
        path: 'liveRoom',
        name: 'liveRoom',
        component: () => import('@/components/LiveRoom')
      },
      {
        path: 'personCenter',
        name: 'personCenter',
        component: () => import('@/layout/student/container/personCenter'),
        children: [{
            path: '',
            name: 'userEdit',
            component: () => import('@/components/UserEdit')
          },
          {
            path: 'personInfo',
            name: 'personInfo',
            component: () => import('@/layout/student/container/components/personInfo')
          },
          {
            path: 'collect',
            name: 'collect',
            component: () => import('@/layout/student/container/components/collect')
          },
          {
            path: 'history',
            name: 'history',
            component: () => import('@/layout/student/container/components/history')
          },
          {
            path: 'message',
            name: 'message',
            component: () => import('@/layout/student/container/components/message')
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404'
  }
];

export const TeacherAsyncRouterMap = [{
    path: '/',
    name: 'teacher',
    component: () => import('@/layout/teacher'),
    children: [{
        path: '',
        redirect: '/classroom'
      },
      {
        path: 'classroom',
        name: 'classroom',
        component: () => import('@/layout/teacher/container/classroom'),
        children: [
          {
            path: '',
            name: 'addLesson',
            component: () => import('@/layout/teacher/container/components/addLesson')
          },
          {
            path: 'addLesson',
            name: 'addLesson',
            component: () => import('@/layout/teacher/container/components/addLesson')
          },
          {
            path: 'lessonManager',
            name: 'lessonManager',
            component: () => import('@/views/lesson-manager')
          },
          {
            path: 'lessonGradeBind',
            name: 'lessonGradeBind',
            component: () => import('@/layout/teacher/container/components/lessonGradeBind')
          },
          {
            path: 'schedule',
            name: 'schedule',
            component: () => import('@/layout/teacher/container/components/schedule')
          },
          {
            path: 'applySwitching',
            name: 'applySwitching',
            component: () => import('@/layout/teacher/container/components/applySwitching')
          },
          {
            path: 'lessonDetail',
            name: 'lessonDetail',
            component: () => import('@/components/LessonDetail')
          },
          {
            path: 'liveRoom',
            name: 'liveRoom',
            component: () => import('@/components/LiveRoom')
          },
        ]
      },
      {
        path: 'personCenter',
        name: 'personCenter',
        component: () => import('@/layout/teacher/container/personCenter'),
        children: [{
            path: '',
            name: 'userEdit',
            component: () => import('@/components/UserEdit')
          },
          {
            path: 'personInfo',
            name: 'personInfo',
            component: () => import('@/layout/student/container/components/personInfo')
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404'
  }
];

export const LeaderAsyncRouterMap = [{
    path: '/',
    name: 'leader',
    component: () => import('@/layout/leader'),
    children: [{
        path: '',
        name: 'userManager',
        component: () => import('@/layout/leader/container/userManager'),
      },
      {
        path: 'roleManager',
        name: 'roleManager',
        component: () => import('@/layout/leader/container/roleManager'),
      },
      {
        path: 'permissionManager',
        name: 'permissionManager',
        component: () => import('@/layout/leader/container/permissionManager'),
      },
      {
        path: 'classManager',
        name: 'classManager',
        component: () => import('@/layout/leader/container/classManager'),
      },
      {
        path: 'subjectManager',
        name: 'subjectManager',
        component: () => import('@/layout/leader/container/subjectManager'),
      },
      {
        path: 'majorManager',
        name: 'majorManager',
        component: () => import('@/layout/leader/container/majorManager'),
      },
      {
        path: 'classSubjectManager',
        name: 'classSubjectManager',
        component: () => import('@/layout/leader/container/classSubjectManager'),
      },
      {
        path: 'scheduleMajorManager',
        name: 'scheduleMajorManager',
        component: () => import('@/layout/leader/container/scheduleMajorManager'),
      },
      {
        path: 'lessonManager',
        name: 'lessonManager',
        component: () => import('@/views/lesson-manager'),
      },
      {
        path: 'scheduleClassManager',
        name: 'scheduleClassManager',
        component: () => import('@/layout/leader/container/scheduleClassManager'),
      },
      {
        path: 'carouselManager',
        name: 'carouselManager',
        component: () => import('@/layout/leader/container/carouselManager'),
      }
    ]
  },
  {
    path: '*',
    redirect: '/404'
  }
];

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: ConstantRouterMap
});

// const router = new VueRouter({
//   mode: 'history',
//   base: process.env.BASE_URL,
//   routes
// })

// export default router